function flipPage(numRowsSelected,numStoreRecords,activePage){
    if (numRowsSelected < numStoreRecords) //remain on same page
        return activePage;
    else { //numRowsSelected == numStoreRecords
        if (activePage == 1) //close window
            return -1;
        else //go to previous page
            return (activePage-1);
    }
}